ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Skylark_Population_Manager Class Reference

#include <skylarks_all.h>

Inheritance diagram for Skylark_Population_Manager:
Population_Manager

Public Member Functions

void CreateObjects (int ob_type, TAnimal *pTAo, void *null, Skylark_struct *data, int number)
 
virtual void Init (void)
 
void WriteSKPOM1 (int n, int n2)
 
void WriteSKPOM2 (int n, int n2)
 
int SupplyM_Mig_Mort ()
 
int SupplyF_Mig_Mort ()
 
int SupplyNoTerritories ()
 
int TheSkylarkTerrsSupply_x (int)
 
int TheSkylarkTerrsSupply_y (int)
 
int TheSkylarkTerrsSupply_size (int)
 
int TheSkylarkTerrsSupply_quality (int)
 
void SetM_Mig_Mort (int m)
 
void SetF_Mig_Mort (int m)
 
 Skylark_Population_Manager (Landscape *L)
 
virtual ~Skylark_Population_Manager (void)
 
int TheFledgelingProbe ()
 
virtual void BreedingPairsOutput (int Time)
 
void FledgelingProbeOutput (int Total, int Time)
 
int TheBreedingFemalesProbe (int ProbeNo)
 
bool OpenTheBreedingPairsProbe ()
 
bool OpenTheFledgelingProbe ()
 
void incNoFledgeDeaths ()
 
void incNoChickDeaths ()
 
void incNoPestEffects ()
 
void incTotalEggs (int eggs)
 
void incTotalNestlings ()
 
void incTotalPrefledgelings ()
 
void AddStriglingMort (int lifestage)
 
double SupplyEMi ()
 
bool IsBadWeather ()
 
virtual bool OpenTheBreedingSuccessProbe ()
 
virtual void BreedingSuccessProbeOutput (double, int, int, int, int, int, int, int)
 
virtual int TheBreedingSuccessProbe (int &BreedingFemales, int &YoungOfTheYear, int &TotalPop, int &TotalFemales, int &TotalMales, int &BreedingAttempts)
 
virtual void TheAOROutputProbe ()
 
virtual void TheRipleysOutputProbe (FILE *a_prb)
 
- Public Member Functions inherited from Population_Manager
 Population_Manager (Landscape *L)
 
virtual ~Population_Manager (void)
 
void SetNoProbes (int a_pn)
 
unsigned GetLiveArraySize (int a_listindex)
 Gets the number of 'live' objects for a list index in the TheArray. More...
 
void IncLiveArraySize (int a_listindex)
 Increments the number of 'live' objects for a list index in the TheArray. More...
 
virtual void Catastrophe (int)
 
unsigned int FarmAnimalCensus (unsigned int a_farm, unsigned int a_typeofanimal)
 
char * SpeciesSpecificReporting (int a_species, int a_time)
 
char * ProbeReport (int a_time)
 
char * ProbeReportTimed (int a_time)
 
void ImpactProbeReport (int a_Time)
 
bool BeginningOfMonth ()
 
void LOG (const char *fname)
 
int SupplyStepSize ()
 
int SupplySimW ()
 
int SupplySimH ()
 
virtual void Run (int NoTSteps)
 
virtual float Probe (int ListIndex, probe_data *p_TheProbe)
 
virtual void ImpactedProbe ()
 
int SupplyListNameLength ()
 
TAnimalSupplyAnimalPtr (int a_index, int a_animal)
 Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK. More...
 
unsigned SupplyListIndexSize ()
 
unsigned SupplyListSize (unsigned listindex)
 
bool CheckXY (int l, int i)
 Debug method to test for out of bounds coordinates. More...
 
const char * SupplyListName (int i)
 
bool IsLast (unsigned listindex)
 
int SupplyState (unsigned listindex, unsigned j)
 
virtual void SupplyLocXY (unsigned listindex, unsigned j, int &x, int &y)
 
const char * SupplyStateNames (int i)
 
unsigned SupplyStateNamesLength ()
 
virtual void DisplayLocations ()
 
int ProbeFileInput (char *p_Filename, int p_ProbeNo)
 
TAnimalFindClosest (int x, int y, unsigned Type)
 
bool OpenTheRipleysOutputProbe (string a_NWordFilename)
 
void OpenTheAOROutputProbe (string a_AORFilename)
 
bool OpenTheMonthlyRipleysOutputProbe ()
 
bool OpenTheReallyBigProbe ()
 
virtual void TheReallyBigOutputProbe ()
 
void CloseTheMonthlyRipleysOutputProbe ()
 
virtual void CloseTheRipleysOutputProbe ()
 
virtual void CloseTheReallyBigOutputProbe ()
 
TTypesOfPopulation GetPopulationType ()
 
int GetSeasonNumber ()
 Get the season number. More...
 
void LamdaDeath (int x, int y)
 
void LamdaBirth (int x, int y)
 
void LamdaBirth (int x, int y, int z)
 
void LamdaClear ()
 
void LamdaDumpOutput ()
 
virtual int SupplyPegPosx (int)
 
virtual int SupplyPegPosy (int)
 
virtual int SupplyCovPosx (int)
 
virtual int SupplyCovPosy (int)
 
virtual void TheGeneticProbe (unsigned, int, unsigned &)
 
virtual void GeneticsResultsOutput (FILE *, unsigned)
 

Public Attributes

SkTerritoriesTheSkylarkTerrs
 
int VegTypeFledgelings [100]
 
- Public Attributes inherited from Population_Manager
int IndexArrayX [5][10000]
 
probe_dataTheProbe [100]
 
int SimH
 
int SimW
 
unsigned SimHH
 
unsigned SimWH
 
char m_SimulationName [255]
 
bool ProbesSet
 
Landscapem_TheLandscape
 

Protected Member Functions

virtual void DoFirst ()
 
void ProbeReportPOM (int a_time)
 
float ProbePOM (int ListIndex, probe_data *p_TheProbe)
 Modified probe for POM Output. More...
 
void LoadParameters ()
 
virtual void Catastrophe ()
 
virtual void ReHouse ()
 
- Protected Member Functions inherited from Population_Manager
virtual bool StepFinished ()
 Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour. More...
 
virtual void DoBefore ()
 
virtual void DoAfter ()
 
virtual void DoAlmostLast ()
 
virtual void DoLast ()
 
void EmptyTheArray ()
 Removes all objects from the TheArray by deleting them and clearing TheArray. More...
 
void SortX (unsigned Type)
 
void SortXIndex (unsigned Type)
 
void SortY (unsigned Type)
 
void SortState (unsigned Type)
 
void SortStateR (unsigned Type)
 
unsigned PartitionLiveDead (unsigned Type)
 
void Shuffle_or_Sort (unsigned Type)
 
void Shuffle (unsigned Type)
 

Protected Attributes

int M_Mig_Mort
 
int F_Mig_Mort
 
double EMi
 
int m_StriglingMort [4]
 
int m_TotalEggs
 
int m_TotalNestlings
 
int m_TotalPrefledgelings
 
int m_NoFledgeDeaths
 
int m_NoChickDeaths
 
int m_NoPestEffects
 
bool m_IsBadWeather
 
FILE * SKPOM1
 
FILE * SKPOM2
 
- Protected Attributes inherited from Population_Manager
vector< unsigned > m_LiveArraySize
 
int m_NoProbes
 
AOR_Probem_AOR_Probe
 
FILE * m_GeneticsFile
 
FILE * m_AlleleFreqsFile
 
FILE * m_EasyPopRes
 
const char * StateNames [100]
 
int m_catastrophestartyear
 
int m_StepSize
 
vector< TListOfAnimalsTheArray
 
unsigned StateNamesLength
 
const char * m_ListNames [32]
 
unsigned m_ListNameLength
 
FILE * TestFile
 
FILE * TestFile2
 
unsigned BeforeStepActions [12]
 
int m_SeasonNumber
 Holds the season number. Used when running goose and hunter sims. More...
 
TTypesOfPopulation m_population_type
 
ofstream * AOROutputPrb
 
FILE * RipleysOutputPrb
 
FILE * RipleysOutputPrb1
 
FILE * RipleysOutputPrb2
 
FILE * RipleysOutputPrb3
 
FILE * RipleysOutputPrb4
 
FILE * RipleysOutputPrb5
 
FILE * RipleysOutputPrb6
 
FILE * RipleysOutputPrb7
 
FILE * RipleysOutputPrb8
 
FILE * RipleysOutputPrb9
 
FILE * RipleysOutputPrb10
 
FILE * RipleysOutputPrb11
 
FILE * RipleysOutputPrb12
 
FILE * ReallyBigOutputPrb
 
long int lamdagrid [2][257][257]
 

Constructor & Destructor Documentation

◆ Skylark_Population_Manager()

Skylark_Population_Manager::Skylark_Population_Manager ( Landscape L)
294  : Population_Manager( L ) {
295  // Five lists are needed so need to remove 5 of the ten default arrays
296  // Clutches,Nestlings,PreFledgelings,Males,Females
297 
298  for ( int i = 0; i < 5; i++ ) {
299  TheArray.pop_back();
300  }
301 
302  M_Mig_Mort = 0;
303  F_Mig_Mort = 0;
304  //
305  /*
306  F_Mig_Mort_min = cfg_femreturnmortmin.value();
307  F_Mig_Mort_max = cfg_femreturnmortmax.value();
308  M_Mig_Mort_min = cfg_malereturnmortmin.value();
309  M_Mig_Mort_max = cfg_malereturnmortmax.value();
310  */
311  //
313  //SkYoungWetDay = cfg_skyoungwetday.value();
314 
315  TheSkylarkTerrs = new SkTerritories( L );
316 #ifdef __CJTDebug_10
317  refnum = 0;
318 #endif
319  Init();
320 }
int value(void)
Definition: configurator.h:98
Population_Manager(Landscape *L)
Definition: PopulationManager.cpp:221
vector< TListOfAnimals > TheArray
Definition: PopulationManager.h:534
Definition: skylarks_all.h:343
int M_Mig_Mort
Definition: skylarks_all.h:459
virtual void Init(void)
Definition: skylarks_all.cpp:323
int F_Mig_Mort
Definition: skylarks_all.h:460
SkTerritories * TheSkylarkTerrs
Definition: skylarks_all.h:567
int JuvenileReturnMort
Definition: skylarks_all.cpp:225
CfgInt cfg_juvreturnmort

References cfg_juvreturnmort, F_Mig_Mort, Init(), JuvenileReturnMort, M_Mig_Mort, Population_Manager::TheArray, TheSkylarkTerrs, and CfgInt::value().

◆ ~Skylark_Population_Manager()

Skylark_Population_Manager::~Skylark_Population_Manager ( void  )
virtual
545  {
546  // delete all lists
547  delete TheSkylarkTerrs;
548 #ifdef __SKPOM
549  fclose(SKPOM1);
550  fclose(SKPOM2);
551 #endif
552 }
FILE * SKPOM1
Definition: skylarks_all.h:472
FILE * SKPOM2
Definition: skylarks_all.h:473

References SKPOM1, SKPOM2, and TheSkylarkTerrs.

Member Function Documentation

◆ AddStriglingMort()

void Skylark_Population_Manager::AddStriglingMort ( int  lifestage)
inline
553  {
554  m_StriglingMort[lifestage] ++;
555  }
int m_StriglingMort[4]
Definition: skylarks_all.h:463

Referenced by Skylark_Base::AddStriglingMort().

◆ BreedingPairsOutput()

void Skylark_Population_Manager::BreedingPairsOutput ( int  Time)
virtual

Reimplemented from Population_Manager.

755  {
756  FILE * MyFile = fopen("BreedingPairs.txt", "a" );
757  if ( !MyFile ) {
758  g_msg->Warn( WARN_FILE, "Skylark_Population_Manager::BreedingPairsOutput():",
759  "Cannot open file for append: BreedingPairs.txt" );
760  exit( 0 );
761  }
762  int no=0;
763  Skylark_Female * FS;
764  int szf = (int)GetLiveArraySize(4);
765  int szm = (int)GetLiveArraySize(3);
766  for ( int j = 0; j < szf; j++ ) {
767  FS = dynamic_cast < Skylark_Female * > ( TheArray[ 4 ] [ j ] );
768  if (FS->Paired) {
769  // Below is a POM test for farm owner 50 - an identifier used to select a single experimental field or set of fields in the polyref file.
771  TTypesOfSkState behav = FS->m_CurrentSkState;
772  switch(behav) {
775  case toss_MakingNest:
776  case toss_Laying:
777  case toss_EggHatching:
778  case toss_Incubating:
780  no++;
781 // g_MainForm->m_aMap->Spot( 3, FS->Supply_m_Location_x(), FS->Supply_m_Location_y() );
782  break;
783  default:
784  ;
785  }
786  }
787  }
788  }
789  fprintf( MyFile, "%d\t%d\t%d\t%d\n", time, no, szf, szm );
790  fclose( MyFile );
791 }
int SupplyFarmOwner(int a_x, int a_y)
Definition: landscape.h:1152
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
unsigned GetLiveArraySize(int a_listindex)
Gets the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:433
bool Paired
Definition: skylarks_all.h:752
TTypesOfSkState m_CurrentSkState
Definition: skylarks_all.h:594
Definition: skylarks_all.h:761
int Supply_m_Location_x()
Definition: PopulationManager.h:213
int Supply_m_Location_y()
Definition: PopulationManager.h:216
class MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41
@ WARN_FILE
Definition: maperrormsg.h:37
Landscape * g_land
This pointer provides access the to landscape module.
Definition: skylarks_all.cpp:49
TTypesOfSkState
Definition: skylarks_all.h:44
@ toss_BuildingUpResources
Definition: skylarks_all.h:58
@ toss_MakingNest
Definition: skylarks_all.h:58
@ toss_EggHatching
Definition: skylarks_all.h:59
@ toss_FCaringForYoung
Definition: skylarks_all.h:59
@ toss_PreparingForBreeding
Definition: skylarks_all.h:58
@ toss_Incubating
Definition: skylarks_all.h:59
@ toss_Laying
Definition: skylarks_all.h:58

References g_land, g_msg, Population_Manager::GetLiveArraySize(), Skylark_Base::m_CurrentSkState, Skylark_Adult::Paired, TAnimal::Supply_m_Location_x(), TAnimal::Supply_m_Location_y(), Landscape::SupplyFarmOwner(), Population_Manager::TheArray, toss_BuildingUpResources, toss_EggHatching, toss_FCaringForYoung, toss_Incubating, toss_Laying, toss_MakingNest, toss_PreparingForBreeding, MapErrorMsg::Warn(), and WARN_FILE.

◆ BreedingSuccessProbeOutput()

void Skylark_Population_Manager::BreedingSuccessProbeOutput ( double  No,
int  BreedingFemales,
int  YoungOfTheYear,
int  TotalPop,
int  TotalFemales,
int  TotalMales,
int  time,
int  BreedingAttempts 
)
virtual

Reimplemented from Population_Manager.

826  {
827  double BreedingSuccess, HatchSuccess, FledgeSuccess;
828  FILE * MyFile = fopen("BreedingSuccess.txt", "a" );
829  if ( !MyFile ) {
830  g_msg->Warn( WARN_FILE, "Skylark_Population_Manager::BreedingAttemptsOutput():",
831  "Cannot open file for append: BreedingAttempts.txt" );
832  exit( 0 );
833  }
834  // Do some calculations
835  double floaters = ( TotalPop - ( YoungOfTheYear + ( BreedingFemales * 2 ) ) ) / ( double )( TotalPop - YoungOfTheYear );
836  HatchSuccess = m_TotalNestlings / ( double )( m_TotalEggs + 1 );
837  FledgeSuccess = m_TotalPrefledgelings / ( double )( m_TotalNestlings + 1 );
838  BreedingSuccess = m_TotalPrefledgelings / ( double )( m_TotalEggs + 1 );
839  // Print the results and data
840  fprintf( MyFile, "%d\t%d\t%d\t%d\t%d\t%d\t%d\t%g\t%g\t%g\t%g\t%g\t\n", time, BreedingFemales, BreedingAttempts, YoungOfTheYear, TotalPop,
841  TotalFemales, TotalMales, floaters, No, HatchSuccess, FledgeSuccess, BreedingSuccess );
842  //fprintf( MyFile, "%i\t%i\t%i\t%i\n", m_StriglingMort[ 0 ], m_StriglingMort[ 1 ],
843  // m_StriglingMort[ 2 ], m_StriglingMort[ 3 ] );
844  for ( int h = 0; h < 4; h++ ) m_StriglingMort[ h ] = 0;
845  fclose( MyFile );
846  // Zero any counters
847  m_TotalEggs = 0;
848  m_TotalNestlings = 0;
850 }
int m_TotalNestlings
Definition: skylarks_all.h:465
int m_TotalPrefledgelings
Definition: skylarks_all.h:466
int m_TotalEggs
Definition: skylarks_all.h:464

References g_msg, m_StriglingMort, m_TotalEggs, m_TotalNestlings, m_TotalPrefledgelings, MapErrorMsg::Warn(), and WARN_FILE.

◆ Catastrophe()

void Skylark_Population_Manager::Catastrophe ( void  )
protectedvirtual

Reimplemented from Population_Manager.

1198  {
1199  // This version simply alters populations on 1st January - it is very dangerous to
1200  // add individuals in many of the models so beware!!!!
1201 
1202  // First do we have the right day?
1203  int today = m_TheLandscape->SupplyDayInYear();
1204  if (today!=1) return;
1205  // First do we have the right year?
1207  if (year%cfg_pm_eventfrequency.value()!=0) return;
1208 
1209  Skylark_Male* MS = NULL; // assignment to get rid of warning
1210  Skylark_Female* FS = NULL;
1211  Skylark_Adult* AS = NULL;
1212  // Now if the % decrease is higher or lower than 100 we need to do different things
1213  int esize=cfg_pm_eventsize.value();
1214  if (esize<100) {
1215  unsigned size2;
1216  size2 = (int)GetLiveArraySize(sob_Male);;
1217  for ( unsigned j = 0; j < size2; j++ ) {
1218  if (random(100) > esize) {
1219  MS = dynamic_cast < Skylark_Male * > ( TheArray[ 3 ] [ j ] );
1220  if (MS->MyMate!=NULL) MS->MyMate->OnMateDying();
1221  MS->Dying(); // Kill it
1222  }
1223  }
1224  size2 = (int)GetLiveArraySize(sob_Female);;
1225  for ( unsigned j = 0; j < size2; j++ ) {
1226  if (random(100) > esize) {
1227  FS = dynamic_cast < Skylark_Female * > ( TheArray[ 4 ] [ j ] );
1228  if (FS->MyMate!=NULL) FS->MyMate->OnMateDying();
1229  FS->Dying(); // Kill it
1230  }
1231  }
1232  }
1233  else if (esize>100) {
1234  // This is a tricky thing to do because we need to duplicate birds, but dare not mess
1235  // mate pointers etc up.
1236  // This also requires a copy method in the target birds
1237  // esize also needs translating 120 = 20%, 200 = 100%
1238  if (esize<200) {
1239  esize-=100;
1240  for (unsigned i=3; i<5; i++) {
1241  unsigned size2;
1242  size2 = (int)GetLiveArraySize(i);
1243  for ( unsigned j = 0; j < size2; j++ ) {
1244  if (random(100) < esize) {
1245  AS = dynamic_cast < Skylark_Adult * > ( TheArray[ i ] [ j ] );
1246  AS->CopyMyself(i); // Duplicate it
1247  }
1248  }
1249  }
1250  } else {
1251  esize-=100;
1252  esize/=100; // this will throw away fractional parts so will get 1, 2, 3 from 200, 350 400
1253  for (unsigned i=3; i<5; i++) {
1254  unsigned size2;
1255  size2 = (int)GetLiveArraySize(i);
1256  for ( unsigned j = 0; j < size2; j++ ) {
1257  for ( int e=0; e<esize; e++) {
1258  AS = dynamic_cast < Skylark_Adult * > ( TheArray[ i ] [ j ] );
1259  AS->CopyMyself(i); // Duplicate it
1260  }
1261  }
1262  }
1263  }
1264  }
1265  else return; // No change so do nothing
1266 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
int SupplyYearNumber(void)
Definition: landscape.h:1616
int SupplyDayInYear(void)
Definition: landscape.h:1596
int m_catastrophestartyear
Definition: PopulationManager.h:532
Landscape * m_TheLandscape
Definition: PopulationManager.h:515
Definition: skylarks_all.h:731
virtual void CopyMyself(int a_sktype)
Definition: skylarks_all.cpp:6792
void OnMateDying()
Definition: skylarks_all.cpp:6034
Skylark_Male * MyMate
Definition: skylarks_all.h:806
Definition: skylarks_all.h:855
void OnMateDying()
Definition: skylarks_all.cpp:4311
Skylark_Female * MyMate
Definition: skylarks_all.h:891
virtual void Dying()
Definition: PopulationManager.h:266
CfgInt cfg_pm_eventsize
CfgInt cfg_pm_eventfrequency
@ sob_Male
Definition: skylarks_all.h:39
@ sob_Female
Definition: skylarks_all.h:40

References cfg_pm_eventfrequency, cfg_pm_eventsize, Skylark_Adult::CopyMyself(), TAnimal::Dying(), Population_Manager::GetLiveArraySize(), Population_Manager::m_catastrophestartyear, Population_Manager::m_TheLandscape, Skylark_Female::MyMate, Skylark_Male::MyMate, Skylark_Female::OnMateDying(), Skylark_Male::OnMateDying(), random(), sob_Female, sob_Male, Landscape::SupplyDayInYear(), Landscape::SupplyYearNumber(), Population_Manager::TheArray, and CfgInt::value().

◆ CreateObjects()

void Skylark_Population_Manager::CreateObjects ( int  ob_type,
TAnimal pTAo,
void *  null,
Skylark_struct data,
int  number 
)
557  {
558  Skylark_Clutch * New_Clutch;
559  Skylark_Nestling * New_Nestling;
560  Skylark_PreFledgeling * New_PreFledgeling;
561  Skylark_Male * New_Male;
562  Skylark_Female * New_Female;
563 
564  skClutch_struct * cs;
565  Nestling_struct * ns;
566  PreFledgeling_struct * pfs;
567  AdultSkylark_struct * as;
568 
569  bool aCopy = false;
570  if (number == -1) { aCopy = true; number = 1; }
571 
572  for (int i = 0; i < number; i++) {
573 #ifdef __CJTDebug_10
574  refnum++;
575 #endif
576  if (ob_type == 0) {
577  cs = dynamic_cast <skClutch_struct *> (data);
578  if (unsigned(TheArray[ob_type].size())>GetLiveArraySize(ob_type)) {
579  // We need to reuse an object
580  dynamic_cast<Skylark_Clutch*>(TheArray[ob_type][GetLiveArraySize(ob_type)])->ReInit(cs->Mum, cs->Terrs, cs->L, cs->No, cs->x, cs->y, cs->mh, this);
581  cs->Mum->OnSetMyClutch(dynamic_cast<Skylark_Clutch*>(TheArray[ob_type][GetLiveArraySize(ob_type)]));
582  IncLiveArraySize(ob_type);
583  }
584  else {
585  New_Clutch = new Skylark_Clutch(cs->Mum, cs->Terrs, cs->L, cs->No, cs->x, cs->y, cs->mh, this);
586  TheArray[ob_type].push_back(New_Clutch);
587  IncLiveArraySize(ob_type);
588  // Give mum the pointer to the clutch
589  cs->Mum->OnSetMyClutch(New_Clutch);
590  }
591 #ifdef __CJTDebug_10
592  New_Clutch->m_Ref = refnum;
593 #endif
594  }
595  if (ob_type == 1) {
596  ns = dynamic_cast <Nestling_struct *> (data);
597  if (unsigned(TheArray[ob_type].size()) > GetLiveArraySize(ob_type)) {
598  // We need to reuse an object
599  dynamic_cast<Skylark_Nestling*>(TheArray[ob_type][GetLiveArraySize(ob_type)])->ReInit(ns->x, ns->y, ns->Dad, ns->L, ns->Terrs, this, ns->bx, ns->by, ns->mh);
600  // Give Dad a pointer to nestling
601  ns->Dad->OnAddNestling(dynamic_cast<Skylark_Nestling*>(TheArray[ob_type][GetLiveArraySize(ob_type)]));
602  IncLiveArraySize(ob_type);
603  }
604  else {
605  New_Nestling = new Skylark_Nestling(ns->x, ns->y, ns->Dad, ns->L, ns->Terrs, this, ns->bx, ns->by, ns->mh);
606  TheArray[ob_type].push_back(New_Nestling);
607  IncLiveArraySize(ob_type);
608  // Give Dad a pointer to nestling
609  ns->Dad->OnAddNestling(New_Nestling);
610  }
611  // Count this as a chick hatched
613 #ifdef __CJTDebug_10
614  New_Nestling->m_Ref = refnum;
615 #endif
616  }
617  if (ob_type == 2) {
618  pfs = dynamic_cast <PreFledgeling_struct *> (data);
619  if (unsigned(TheArray[ob_type].size()) > GetLiveArraySize(ob_type)) {
620  // We need to reuse an object
621  dynamic_cast<Skylark_PreFledgeling*>(TheArray[ob_type][GetLiveArraySize(ob_type)])->ReInit(pfs->x, pfs->y, pfs->L, pfs->Terrs, pfs->Dad, pfs->sex, pfs->size, pfs->age, this,
622  pfs->bx, pfs->by, pfs->mh);
623  if (pfs->Dad) pfs->Dad->OnAddPreFledgeling(dynamic_cast<Skylark_PreFledgeling*>(TheArray[ob_type][GetLiveArraySize(ob_type)]), (Skylark_Nestling *)pTAo);
624  IncLiveArraySize(ob_type);
625  }
626  else {
627  New_PreFledgeling = new
628  Skylark_PreFledgeling(pfs->x, pfs->y, pfs->L, pfs->Terrs, pfs->Dad, pfs->sex, pfs->size, pfs->age, this,
629  pfs->bx, pfs->by, pfs->mh);
630 
631  TheArray[ob_type].push_back(New_PreFledgeling);
632  IncLiveArraySize(ob_type);
633  if (pfs->Dad) pfs->Dad->OnAddPreFledgeling(New_PreFledgeling, (Skylark_Nestling *)pTAo);
634  }
635  // Count this as a nest leaver
637  }
638  if (ob_type == 3) {
639  as = dynamic_cast <AdultSkylark_struct *> (data);
640  // Male
641  if (unsigned(TheArray[ob_type].size()) > GetLiveArraySize(ob_type)) {
642  // We need to reuse an object
643  dynamic_cast<Skylark_Male*>(TheArray[ob_type][GetLiveArraySize(ob_type)])->ReInit(as->x, as->y, as->size, as->age, as->Terrs, as->L, this, as->bx, as->by, as->mh);
644  IncLiveArraySize(ob_type);
645  }
646  else {
647  New_Male = new Skylark_Male(as->x, as->y, as->size, as->age, as->Terrs, as->L, this, as->bx, as->by, as->mh);
648  if (aCopy) New_Male->SensibleCopy();
649  TheArray[ob_type].push_back(New_Male);
650  IncLiveArraySize(ob_type);
651  }
652 #ifdef __CJTDebug_10
653  New_Male->m_Ref = refnum;
654 #endif
655  }
656  if (ob_type == 4) {
657  as = dynamic_cast <AdultSkylark_struct *> (data);
658  // Female
659  if (unsigned(TheArray[ob_type].size()) > GetLiveArraySize(ob_type)) {
660  // We need to reuse an object
661  dynamic_cast<Skylark_Female*>(TheArray[ob_type][GetLiveArraySize(ob_type)])->ReInit(as->x, as->y, as->size, as->age, as->Terrs, as->L, this, as->bx, as->by, as->mh);
662  IncLiveArraySize(ob_type);
663  }
664  else {
665  New_Female = new Skylark_Female(as->x, as->y, as->size, as->age, as->Terrs, as->L, this, as->bx, as->by, as->mh);
666  if (aCopy) New_Female->SensibleCopy();
667  TheArray[ob_type].push_back(New_Female);
668  IncLiveArraySize(ob_type);
669  }
670 #ifdef __CJTDebug_10
671  New_Female->m_Ref = refnum;
672 #endif
673  }
674  }
675 }
Definition: skylarks_all.h:251
double size
Definition: skylarks_all.h:253
int age
Definition: skylarks_all.h:255
Definition: skylarks_all.h:228
Skylark_Male * Dad
Definition: skylarks_all.h:230
void IncLiveArraySize(int a_listindex)
Increments the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:437
Definition: skylarks_all.h:238
int age
Definition: skylarks_all.h:243
bool sex
Definition: skylarks_all.h:242
double size
Definition: skylarks_all.h:240
Skylark_Male * Dad
Definition: skylarks_all.h:241
Definition: skylarks_all.h:637
void OnSetMyClutch(Skylark_Clutch *p_C)
Definition: skylarks_all.h:832
void SensibleCopy()
Definition: skylarks_all.cpp:6813
void SensibleCopy()
Definition: skylarks_all.cpp:6820
void OnAddNestling(Skylark_Nestling *N)
Definition: skylarks_all.cpp:4834
void OnAddPreFledgeling(Skylark_PreFledgeling *P, Skylark_Nestling *N)
Definition: skylarks_all.cpp:4404
Definition: skylarks_all.h:678
Definition: skylarks_all.h:710
int bx
Definition: skylarks_all.h:200
Landscape * L
Definition: skylarks_all.h:203
int x
Definition: skylarks_all.h:198
SkTerritories * Terrs
Definition: skylarks_all.h:204
int y
Definition: skylarks_all.h:199
int mh
Definition: skylarks_all.h:202
int by
Definition: skylarks_all.h:201
Definition: skylarks_all.h:217
Skylark_Female * Mum
Definition: skylarks_all.h:220
int No
Definition: skylarks_all.h:219

References PreFledgeling_struct::age, AdultSkylark_struct::age, Skylark_struct::bx, Skylark_struct::by, Nestling_struct::Dad, PreFledgeling_struct::Dad, Population_Manager::GetLiveArraySize(), Population_Manager::IncLiveArraySize(), Skylark_struct::L, m_TotalNestlings, m_TotalPrefledgelings, Skylark_struct::mh, skClutch_struct::Mum, skClutch_struct::No, Skylark_Male::OnAddNestling(), Skylark_Male::OnAddPreFledgeling(), Skylark_Female::OnSetMyClutch(), Skylark_Female::SensibleCopy(), Skylark_Male::SensibleCopy(), PreFledgeling_struct::sex, PreFledgeling_struct::size, AdultSkylark_struct::size, Skylark_struct::Terrs, Population_Manager::TheArray, Skylark_struct::x, and Skylark_struct::y.

Referenced by Skylark_Adult::CopyMyself(), Init(), Skylark_Clutch::st_Hatching(), Skylark_Female::st_Laying(), Skylark_Nestling::st_Maturing(), and Skylark_PreFledgeling::st_Maturing().

◆ DoFirst()

void Skylark_Population_Manager::DoFirst ( void  )
protectedvirtual

Can be used in descendent classes

Reimplemented from Population_Manager.

939  {
940  //printf("Day %d Terrs: %d Occupied M/F %d/%d\n",g_date->DayInYear(),TheSkylarkTerrs->SupplyNoTerritories(), TheSkylarkTerrs->SupplyNoMaleOccupied(), TheSkylarkTerrs->SupplyNoFemaleOccupied());
941  // Bad weather criteria - not used as of 24 June 2009 because removing this had no impacts on the observed POM testing.
942  if ((g_weather->GetRain()>0.0) && (g_weather->GetWindPeriod(g_date->Date(),7)>45.0) && (g_weather->GetTempPeriod(g_date->Date(),7)<40.0) ) m_IsBadWeather=true; else m_IsBadWeather=false;
944  double temp = m_TheLandscape->SupplyTemp();
945  EMi = ( 31.2 - ( 0.44 * temp ) );
946  int today = m_TheLandscape->SupplyDayInYear();
947  if ( today == January ) {
948  for ( int h = 0; h < 4; h++ ) m_StriglingMort[ h ] = 0;
950  // Now re-house any males that already had territories
951  //ReHouse(); // Only needed if PreProcessLandsape2 is called after arrival
952  // Determine this years mortality
953  F_Mig_Mort = cfg_adultreturnmort.value(); //F_Mig_Mort_min + random( F_Mig_Mort_max - F_Mig_Mort_min );
954  // F_Mig_Mort=50;
955  //assume that male and female mortality is equal
957  //M_Mig_Mort = M_Mig_Mort_min + random( M_Mig_Mort_max - M_Mig_Mort_min );
958  // F_Mig_Mort=F_Mig_Mort_min+random(F_Mig_Mort_max-F_Mig_Mort_min);
959  // **CJT** testing code below
960  FILE* MyFile=fopen( "PestEffects.txt", "a" );
961  fprintf( MyFile, "%d %d %d\n", m_NoChickDeaths, m_NoFledgeDeaths, m_NoPestEffects );
962  fclose( MyFile );
963  m_NoFledgeDeaths = 0;
964  m_NoChickDeaths = 0;
965  m_NoPestEffects = 0;
966 }
967 
968 #ifdef __SKPOM
969  // Skylark POM outputs
970 #ifdef __KALONOSCRAPES
971  /* USE FOR KALO & NO SCRAPES */
972 switch (today) {
973  case 70:
974  return ProbeReportPOM( today );
975  break;
976  case 80:
977  return ProbeReportPOM( today );
978  break;
979  case 89:
980  return ProbeReportPOM( today );
981  break;
982  case 99:
983  return ProbeReportPOM( today );
984  break;
985  case 115:
986  return ProbeReportPOM( today );
987  break;
988  case 123:
989  return ProbeReportPOM( today );
990  break;
991  case 130:
992  return ProbeReportPOM( today );
993  break;
994  case 140:
995  return ProbeReportPOM( today );
996  break;
997  case 147:
998  return ProbeReportPOM( today );
999  break;
1000  case 153:
1001  return ProbeReportPOM( today );
1002  break;
1003  case 160:
1004  return ProbeReportPOM( today );
1005  break;
1006  case 168:
1007  return ProbeReportPOM( today );
1008  break;
1009  case 177:
1010  return ProbeReportPOM( today );
1011  break;
1012  case 185:
1013  return ProbeReportPOM( today );
1014  break;
1015  case 192:
1016  return ProbeReportPOM( today );
1017  break;
1018  case 200:
1019  return ProbeReportPOM( today );
1020  break;
1021  case 209:
1022  return ProbeReportPOM( today );
1023  break;
1024  default: ;
1025  }
1026 #else
1027 #ifdef __KALOSCRAPES
1028 /* USE FOR KALO & SCRAPES */
1029 switch (today) {
1030  case 67:
1031  return ProbeReportPOM( today );
1032  break;
1033  case 70:
1034  return ProbeReportPOM( today );
1035  break;
1036  case 80:
1037  return ProbeReportPOM( today );
1038  break;
1039  case 89:
1040  return ProbeReportPOM( today );
1041  break;
1042  case 99:
1043  return ProbeReportPOM( today );
1044  break;
1045  case 113:
1046  return ProbeReportPOM( today );
1047  break;
1048  case 125:
1049  return ProbeReportPOM( today );
1050  break;
1051  case 130:
1052  return ProbeReportPOM( today );
1053  break;
1054  case 131:
1055  return ProbeReportPOM( today );
1056  break;
1057  case 140:
1058  return ProbeReportPOM( today );
1059  break;
1060  case 147:
1061  return ProbeReportPOM( today );
1062  break;
1063  case 153:
1064  return ProbeReportPOM( today );
1065  break;
1066  case 162:
1067  return ProbeReportPOM( today );
1068  break;
1069  case 169:
1070  return ProbeReportPOM( today );
1071  break;
1072  case 178:
1073  return ProbeReportPOM( today );
1074  break;
1075  case 183:
1076  return ProbeReportPOM( today );
1077  break;
1078  default: ;
1079  }
1080 #else
1081  switch (today) {
1082  case 105:
1083  return ProbeReportPOM( today );
1084  break;
1085  case 119:
1086  return ProbeReportPOM( today );
1087  break;
1088  case 133:
1089  return ProbeReportPOM( today );
1090  break;
1091  case 147:
1092  return ProbeReportPOM( today );
1093  break;
1094  case 162:
1095  return ProbeReportPOM( today );
1096  break;
1097  case 177:
1098  return ProbeReportPOM( today );
1099  break;
1100  case 192:
1101  return ProbeReportPOM( today );
1102  break;
1103  case 207:
1104  return ProbeReportPOM( today );
1105  break;
1106  default: ;
1107  }
1108 #endif
1109 
1110 #endif
1111 
1112 #endif
1113  //Sigh, everyday we need to update the territory qualities, but at least it only needs doing here!
1115 }
class Calendar * g_date
Definition: calendar.cpp:38
long Date(void)
Definition: calendar.h:57
double SupplyTemp(void)
Definition: landscape.h:1386
void PreProcessLandscape2(Landscape *L)
Definition: skylarks_all.cpp:2016
void EvaluateAllTerritories(void)
Definition: skylarks_all.cpp:2239
void Tick(void)
Definition: skylarks_all.h:390
double EMi
Definition: skylarks_all.h:461
void ProbeReportPOM(int a_time)
Definition: skylarks_all.cpp:1119
int m_NoFledgeDeaths
Definition: skylarks_all.h:467
int m_NoPestEffects
Definition: skylarks_all.h:469
bool m_IsBadWeather
Definition: skylarks_all.h:470
int m_NoChickDeaths
Definition: skylarks_all.h:468
double GetWindPeriod(long a_date, unsigned int a_period)
Definition: weather.cpp:262
double GetRain(long a_date)
Definition: weather.h:423
double GetTempPeriod(long a_date, unsigned int a_period)
Definition: weather.cpp:272
const int January
Definition: landscape.h:36
CfgInt cfg_adultreturnmort
class Weather * g_weather
Definition: weather.cpp:41

References cfg_adultreturnmort, Calendar::Date(), EMi, SkTerritories::EvaluateAllTerritories(), F_Mig_Mort, g_date, g_weather, Weather::GetRain(), Weather::GetTempPeriod(), Weather::GetWindPeriod(), January, m_IsBadWeather, M_Mig_Mort, m_NoChickDeaths, m_NoFledgeDeaths, m_NoPestEffects, m_StriglingMort, Population_Manager::m_TheLandscape, SkTerritories::PreProcessLandscape2(), ProbeReportPOM(), Landscape::SupplyDayInYear(), Landscape::SupplyTemp(), TheSkylarkTerrs, SkTerritories::Tick(), and CfgInt::value().

◆ FledgelingProbeOutput()

void Skylark_Population_Manager::FledgelingProbeOutput ( int  Total,
int  Time 
)
virtual

Reimplemented from Population_Manager.

880  {
881  FILE * MyFile = fopen("SkFledgelingProbe.txt", "a" );
882  if ( !MyFile ) {
883  g_msg->Warn( WARN_FILE, "Skylark_Population_Manager::FledgelingProbeOutput():",
884  "Cannot open file for append: SkFledgelingProbe.txt" );
885  exit( 0 );
886  }
887  fprintf( MyFile, "%8d %6d", time, Total );
888  // Now get the areas
889  for ( int i = 0; i <= tov_Undefined; i++ )
890  fprintf( MyFile, " %3d %5d %9.0f", i, VegTypeFledgelings[ i ], m_TheLandscape->GetVegArea( i ) );
891  fprintf( MyFile, "\n" );
892  fclose( MyFile );
893  // Data for the FledgelingProbe needs clearing
894  for ( int i = 0; i < 100; i++ ) {
895  VegTypeFledgelings[ i ] = 0;
896  }
897 }
double GetVegArea(int v)
Definition: landscape.h:170
int VegTypeFledgelings[100]
Definition: skylarks_all.h:568
@ tov_Undefined
Definition: tov_declaration.h:114

References g_msg, Landscape::GetVegArea(), Population_Manager::m_TheLandscape, tov_Undefined, VegTypeFledgelings, MapErrorMsg::Warn(), and WARN_FILE.

◆ incNoChickDeaths()

void Skylark_Population_Manager::incNoChickDeaths ( )
inline
528  {
529  m_NoChickDeaths++;
530  }

◆ incNoFledgeDeaths()

void Skylark_Population_Manager::incNoFledgeDeaths ( )
inline
523  {
525  }

◆ incNoPestEffects()

void Skylark_Population_Manager::incNoPestEffects ( )
inline
533  {
534  m_NoPestEffects++;
535  }

◆ incTotalEggs()

void Skylark_Population_Manager::incTotalEggs ( int  eggs)
inline
538  {
539  m_TotalEggs+=eggs;
540  }

◆ incTotalNestlings()

void Skylark_Population_Manager::incTotalNestlings ( )
inline
543  {
545  }

◆ incTotalPrefledgelings()

void Skylark_Population_Manager::incTotalPrefledgelings ( )
inline
548  {
550  }

◆ Init()

void Skylark_Population_Manager::Init ( void  )
virtual
323  {
324  if ( cfg_RipleysOutput_used.value() ) {
326  }
327  LoadParameters();
328  // autom. called by constructor
329  strcpy( m_SimulationName, "Skylark" );
330  // Create 100 male and female skylarks
331  AdultSkylark_struct * aps;
332  aps = new AdultSkylark_struct;
333  aps->size = 38;
334  aps->Terrs = TheSkylarkTerrs;
335  aps->L = m_TheLandscape;
337  aps->sex = true;
338 
339 
340 
341  for ( int i = 0; i < cfg_SkStartNos.value(); i++ ) {
344  aps->bx = aps->x;
345  aps->by = aps->y;
346  aps->age = random( 5 );
347  aps->mh = tov_Undefined;
348  CreateObjects( 3, NULL, NULL, aps, 1 );
349  }
350  aps->sex = false;
351  for ( int i = 0; i < cfg_SkStartNos.value(); i++ ) {
354  aps->bx = aps->x;
355  aps->by = aps->y;
356  aps->age = random( 5 );
357  aps->mh = tov_Undefined;
358  CreateObjects( 4, NULL, NULL, aps, 1 );
359  }
360  delete aps;
361 
362 
363  // Load List of Animal Classes
364  m_ListNames[ 0 ] = "Clutch";
365  m_ListNames[ 1 ] = "Nestling";
366  m_ListNames[ 2 ] = "Pre-Fledgeling";
367  m_ListNames[ 3 ] = "Male";
368  m_ListNames[ 4 ] = "Female";
369  m_ListNameLength = 5;
371 
372  // Load State Names
373  StateNames[ toss_Initiation ] = "Initiation";
374  //Clutch
375  StateNames[ toss_Developing ] = "CDeveloping";
376  StateNames[ toss_Hatching ] = "CHatching";
377  StateNames[ toss_CDying ] = "CDying";
378  //Nestling
379  StateNames[ toss_NDeveloping ] = "NDeveloping";
380  StateNames[ toss_NMaturing ] = "NMaturing";
381  StateNames[ toss_NDying ] = "NDying";
382  //PreFledgeling
383  StateNames[ toss_PDeveloping ] = "PDeveloping";
384  StateNames[ toss_PMaturing ] = "PMaturing";
385  StateNames[ toss_PDying ] = "PDying";
386  //MaleSK
387  StateNames[ toss_MFlocking ] = "MFlocking";
388  StateNames[ toss_MFloating ] = "MFloating";
389  StateNames[ toss_MArriving ] = "MArriving";
390  StateNames[ toss_MImmigrating ] = "MImmigrating";
391  StateNames[ toss_MEmigrating ] = "MEmigrating";
392  StateNames[ toss_MTempLeavingArea ] = "MTempLeavingArea";
393  StateNames[ toss_MFindingTerritory ] = "MFindingTerritory";
394  StateNames[ toss_AttractingAMate ] = "MAttractingAMate";
395  StateNames[ toss_FollowingMate ] = "MFollowingMate";
396  StateNames[ toss_ScaringOffChicks ] = "MScaringOffChicks";
397  StateNames[ toss_MCaringForYoung ] = "MCaringForYoung";
398  StateNames[ toss_MDying ] = "MDying";
399  //FemaleSK
400  StateNames[ toss_FFlocking ] = "FFlocking";
401  StateNames[ toss_FFloating ] = "FFloating";
402  StateNames[ toss_FArriving ] = "FArriving";
403  StateNames[ toss_FImmigrating ] = "FImmigrating";
404  StateNames[ toss_FEmigrating ] = "FEmigrating";
405  StateNames[ toss_FTempLeavingArea ] = "FTempLeavingArea";
406  StateNames[ toss_FFindingTerritory ] = "FFindingTerritory";
407  StateNames[ toss_BuildingUpResources ] = "FBuildingUpResources";
408  StateNames[ toss_MakingNest ] = "FMakingNest";
409  StateNames[ toss_PreparingForBreeding ] = "FPreparingForBreeding";
410  StateNames[ toss_Laying ] = "FLaying";
411  StateNames[ toss_StartingNewBrood ] = "FStartingNewBrood";
412  StateNames[ toss_EggHatching ] = "FEggHatching";
413  StateNames[ toss_Incubating ] = "FIncubating";
414  StateNames[ toss_StoppingBreeding ] = "FStoppingBreeding";
415  StateNames[ toss_FCaringForYoung ] = "FCaringForYoung";
416  StateNames[ toss_FDying ] = "FDying";
417  StateNames[ toss_GivingUpTerritory ] = "FGivingUpTerritory";
418  StateNames[ toss_Destroy ] = "Being Destroyed";
419  // determine whether we should shuffle, or sort or do nothing to skylarks
420  // after each time step.
421  BeforeStepActions[ 0 ] = 3; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
422  BeforeStepActions[ 1 ] = 3; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
423  BeforeStepActions[ 2 ] = 3; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
424  BeforeStepActions[ 3 ] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
425  BeforeStepActions[ 4 ] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
426  // Zero any counters
427  m_TotalEggs = 0;
428  m_TotalNestlings = 0;
430  m_NoFledgeDeaths = 0;
431  m_NoChickDeaths = 0;
432  m_NoPestEffects = 0;
433 
436  } else ReallyBigOutputPrb=0;
437 #ifdef __SKPOM
438  SKPOM1 = fopen( "SkylarkPOM1.txt", "w" );
439  SKPOM2 = fopen( "SkylarkPOM2.txt", "w" );
440 #endif
441 }
@ TOP_Skylark
Definition: PopulationManager.h:60
bool sex
Definition: skylarks_all.h:254
bool value(void)
Definition: configurator.h:135
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
FILE * ReallyBigOutputPrb
Definition: PopulationManager.h:595
const char * m_ListNames[32]
Definition: PopulationManager.h:537
char m_SimulationName[255]
Definition: PopulationManager.h:513
unsigned BeforeStepActions[12]
Definition: PopulationManager.h:542
const char * StateNames[100]
Definition: PopulationManager.h:531
bool OpenTheRipleysOutputProbe(string a_NWordFilename)
Definition: PopulationManager.cpp:757
unsigned m_ListNameLength
Definition: PopulationManager.h:538
TTypesOfPopulation m_population_type
Definition: PopulationManager.h:580
bool OpenTheReallyBigProbe()
Definition: PopulationManager.cpp:859
void LoadParameters()
Definition: skylarks_all.cpp:446
void CreateObjects(int ob_type, TAnimal *pTAo, void *null, Skylark_struct *data, int number)
Definition: skylarks_all.cpp:557
CfgInt cfg_SkStartNos
CfgBool cfg_ReallyBigOutput_used
CfgBool cfg_RipleysOutput_used
@ toss_StartingNewBrood
Definition: skylarks_all.h:59
@ toss_Initiation
Definition: skylarks_all.h:45
@ toss_FEmigrating
Definition: skylarks_all.h:57
@ toss_MCaringForYoung
Definition: skylarks_all.h:55
@ toss_FDying
Definition: skylarks_all.h:59
@ toss_MDying
Definition: skylarks_all.h:55
@ toss_StoppingBreeding
Definition: skylarks_all.h:59
@ toss_NDying
Definition: skylarks_all.h:49
@ toss_MFlocking
Definition: skylarks_all.h:53
@ toss_Developing
Definition: skylarks_all.h:47
@ toss_FImmigrating
Definition: skylarks_all.h:57
@ toss_FTempLeavingArea
Definition: skylarks_all.h:57
@ toss_MEmigrating
Definition: skylarks_all.h:53
@ toss_Destroy
Definition: skylarks_all.h:62
@ toss_MFloating
Definition: skylarks_all.h:53
@ toss_MImmigrating
Definition: skylarks_all.h:53
@ toss_MArriving
Definition: skylarks_all.h:53
@ toss_FFindingTerritory
Definition: skylarks_all.h:58
@ toss_NMaturing
Definition: skylarks_all.h:49
@ toss_PDying
Definition: skylarks_all.h:51
@ toss_AttractingAMate
Definition: skylarks_all.h:54
@ toss_FollowingMate
Definition: skylarks_all.h:54
@ toss_ScaringOffChicks
Definition: skylarks_all.h:54
@ toss_CDying
Definition: skylarks_all.h:47
@ toss_PDeveloping
Definition: skylarks_all.h:51
@ toss_NDeveloping
Definition: skylarks_all.h:49
@ toss_Hatching
Definition: skylarks_all.h:47
@ toss_FFlocking
Definition: skylarks_all.h:57
@ toss_PMaturing
Definition: skylarks_all.h:51
@ toss_MTempLeavingArea
Definition: skylarks_all.h:53
@ toss_FArriving
Definition: skylarks_all.h:57
@ toss_GivingUpTerritory
Definition: skylarks_all.h:60
@ toss_MFindingTerritory
Definition: skylarks_all.h:54
@ toss_FFloating
Definition: skylarks_all.h:57

References AdultSkylark_struct::age, Population_Manager::BeforeStepActions, Skylark_struct::bx, Skylark_struct::by, cfg_ReallyBigOutput_used, cfg_RipleysOutput_used, cfg_SkStartNos, CreateObjects(), g_land, Skylark_struct::L, LoadParameters(), Population_Manager::m_ListNameLength, Population_Manager::m_ListNames, m_NoChickDeaths, m_NoFledgeDeaths, m_NoPestEffects, Population_Manager::m_population_type, Population_Manager::m_SimulationName, Population_Manager::m_TheLandscape, m_TotalEggs, m_TotalNestlings, m_TotalPrefledgelings, Skylark_struct::mh, Population_Manager::OpenTheReallyBigProbe(), Population_Manager::OpenTheRipleysOutputProbe(), random(), Population_Manager::ReallyBigOutputPrb, AdultSkylark_struct::sex, AdultSkylark_struct::size, SKPOM1, SKPOM2, Population_Manager::StateNames, Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), Skylark_struct::Terrs, TheSkylarkTerrs, TOP_Skylark, toss_AttractingAMate, toss_BuildingUpResources, toss_CDying, toss_Destroy, toss_Developing, toss_EggHatching, toss_FArriving, toss_FCaringForYoung, toss_FDying, toss_FEmigrating, toss_FFindingTerritory, toss_FFloating, toss_FFlocking, toss_FImmigrating, toss_FollowingMate, toss_FTempLeavingArea, toss_GivingUpTerritory, toss_Hatching, toss_Incubating, toss_Initiation, toss_Laying, toss_MakingNest, toss_MArriving, toss_MCaringForYoung, toss_MDying, toss_MEmigrating, toss_MFindingTerritory, toss_MFloating, toss_MFlocking, toss_MImmigrating, toss_MTempLeavingArea, toss_NDeveloping, toss_NDying, toss_NMaturing, toss_PDeveloping, toss_PDying, toss_PMaturing, toss_PreparingForBreeding, toss_ScaringOffChicks, toss_StartingNewBrood, toss_StoppingBreeding, tov_Undefined, CfgInt::value(), CfgBool::value(), Skylark_struct::x, and Skylark_struct::y.

Referenced by Skylark_Population_Manager().

◆ IsBadWeather()

bool Skylark_Population_Manager::IsBadWeather ( )
inline
563  {
564  return m_IsBadWeather;
565  }

◆ LoadParameters()

void Skylark_Population_Manager::LoadParameters ( void  )
protected
446  {
448  NotTramline = 1 - IsTramline;
449 
450 
466  MaxFeedRain = cfg_maxfeedrain.value(); //Estimate of really serious amount of rain
467 
474  EggTemp = cfg_EggTemp.value(); //was 37
475  MD_Threshold = cfg_MD_Threshold.value(); // was 12
478  MD_Hatch = cfg_MinDaysToHatch.value() * 24 * 60 * ( EggTemp - MD_Threshold ); // 9.8 fastest development from field data
479  //MD_Hatch = cfg_MinDaysToHatch.value() * 24 * 60;
481 
482  for ( int h = 0; h <= 110; h++ ) {
483  DensityScore[ h ] = 0.0;
484  VegHindranceD[ h ] = 1.0;
485  HeightScore[ h ] = 0.0;
486  VegHindranceH[ h ] = 1.0;
487  }
488  // Vegetation hindrance is made up of two parts - a densithy and height part
489  // Each a linear after a threshold level, down to another threshold (zero)
490 
491  double threshold = cfg_heightconstant_c.value();
492  for ( int h = (int) threshold; h <= 110; h++ ) {
493  VegHindranceH[ h ] = 1 + h * cfg_hindconstantH_b.value();
494  if ( VegHindranceH[ h ] <= 0 ) VegHindranceH[ h ] = 0;
495  }
496  threshold = cfg_densityconstant_c.value();
497  for ( int d = (int) threshold; d <= 110; d++ ) {
498  VegHindranceD[ d ] =1 + d * cfg_hindconstantD_b.value();
499  if ( VegHindranceD[ d ] <= 0 ) VegHindranceD[ d ] = 0;
500  }
501 
502  // The next two arrays are related to nest choice
503  threshold = cfg_densityconstant_c.value();
504  for ( int h = (int) threshold; h <= 110; h++ ) {
505  // Power function
506  // DensityScore[ h ] = cfg_densityconstant_a.value() * pow( h - ( threshold - 1 ), cfg_densityconstant_b.value() );
507  // Linear
508  DensityScore[ h ] = cfg_densityconstant_a.value() + (( h - threshold )*( h - threshold ) * cfg_densityconstant_b.value());
509  // Catch all just in case:
510  //if ( DensityScore[ h ] < 0 ) DensityScore[ h ] = 0;
511  }
512  threshold = cfg_heightconstant_c.value();
513  for ( int h = (int) threshold; h <= 110; h++ ) {
514  // Power function
515  //double hh = cfg_heightconstant_a.value() * pow( h - ( threshold - 1 ), cfg_heightconstant_b.value() );
516  //HeightScore[ h ] = hh - ( 1 - hh ); // This expands the range of the curve
517  // Linear
518  HeightScore[ h ] = cfg_heightconstant_a.value() + ( h - threshold ) * cfg_heightconstant_b.value();
519  // Catch all just in case:
520  //if ( HeightScore[ h ] < 0 ) HeightScore[ h ] = 0;
521  }
522  for ( int i = 0; i <= 30; i++ ) {
523  // TempHindrance[ i ] = (1-( pow( 30 - i, cfg_temphindpow.value() ) / pow( 30, cfg_temphindpow.value() ) ));
524  if ( i > 20 ) TempHindrance[ i ] = 1.0; else
525  TempHindrance[ i ] = 0.0
526  + ( 1.0 * ( 1 - ( pow( (double) 20 - i, (double) cfg_temphindpow.value() ) / pow( (double) 20, (double) cfg_temphindpow.value() ) ) ) );
527  }
528  for ( int i = 0; i <= 10; i++ ) {
529  RainHindrance[ i ] = pow( (double) 10 - i, (double) cfg_rainhindpow.value() ) / (double) pow( (double) 10.0, (double) cfg_rainhindpow.value() );
530  }
531  // Data for the FledgelingProbe
532  for ( int i = 0; i < 100; i++ ) VegTypeFledgelings[ i ] = 0;
533 
534  m_NoFledgeDeaths = 0;
535  m_NoChickDeaths = 0;
536  m_NoPestEffects = 0;
537  FILE * MyFile = fopen( "PestEffects.txt", "w" );
538  fclose( MyFile );
540 }
double value(void)
Definition: configurator.h:118
virtual bool OpenTheBreedingSuccessProbe()
Definition: skylarks_all.cpp:867
int HQualityVeg30cm
Definition: skylarks_all.cpp:263
CfgInt cfg_HQualityTrack
CfgFloat cfg_MD_Threshold
double TempHindrance[31]
Definition: skylarks_all.cpp:215
CfgFloat cfg_maxfeedrain
static double NestLeavingWeight
Definition: skylarks_all.cpp:173
int HQualityTrack
Definition: skylarks_all.cpp:257
CfgInt cfg_temphindpow
int HQualityBareEarth
Definition: skylarks_all.cpp:268
double RainHindrance[21]
Definition: skylarks_all.cpp:214
double HeightScore[111]
Definition: skylarks_all.cpp:219
static int Breed_Res_Thresh1
Definition: skylarks_all.cpp:185
CfgFloat cfg_EggTemp
CfgInt cfg_rainhindpow
double IsTramline
Definition: skylarks_all.cpp:247
CfgInt cfg_HQualityNeutral
CfgInt cfg_HQualityOpenTallVeg
CfgInt cfg_HQualityBareEarth
CfgFloat cfg_heightconstant_a
double NestPlacementMinQual
The minimum quality for nest placement.
Definition: skylarks_all.cpp:253
CfgFloat cfg_MeanHatchingWeight
CfgInt cfg_PatchyPremium
CfgFloat cfg_MinDaysToHatch
static double MeanHatchingWeight
Definition: skylarks_all.cpp:179
double DensityScore[111]
Definition: skylarks_all.cpp:218
static double EggTemp
Definition: skylarks_all.cpp:181
int HQualityNeutral
Definition: skylarks_all.cpp:260
int HQualityOpenTallVeg
Definition: skylarks_all.cpp:254
double VegHindranceD[111]
Definition: skylarks_all.cpp:217
CfgInt cfg_HQualityTallVeg
CfgInt cfg_HQualityTall
CfgFloat cfg_hindconstantH_b
CfgFloat cfg_FemaleMinTerritoryAcceptScore
static int ClutchMortProb
Definition: skylarks_all.cpp:176
CfgFloat cfg_NestPlacementMinQual
static double MeanExtractionRatePerMinute
Definition: skylarks_all.cpp:183
CfgInt cfg_HQualityWater
CfgInt cfg_PreFledgeMortProb
CfgFloat cfg_tramline_foraging
int HQualityTall
Definition: skylarks_all.cpp:255
static double MD_Hatch
Definition: skylarks_all.cpp:186
CfgInt cfg_HQualityHedge
static double Cooling_Rate_Eggs
Definition: skylarks_all.cpp:180
double MaxFeedRain
Definition: skylarks_all.cpp:222
static int PreFledgeMortProb
Definition: skylarks_all.cpp:178
CfgInt cfg_heightconstant_c
int HQualityWater
Definition: skylarks_all.cpp:262
CfgInt cfg_FoodTripsPerDay
CfgInt cfg_HQualityVeg30cm
CfgInt cfg_densityconstant_c
CfgFloat cfg_densityconstant_a
CfgFloat cfg_NestLeavingWeight
double FemaleNestAcceptScore
Definition: skylarks_all.cpp:249
int HQualityHedgeScrub
Definition: skylarks_all.cpp:259
double VegHindranceH[111]
Definition: skylarks_all.cpp:216
int HQualityHedge
Definition: skylarks_all.cpp:261
CfgInt cfg_HQualityMetalRoad
int PatchyPremium
Definition: skylarks_all.cpp:265
static int NestlingMortProb
Definition: skylarks_all.cpp:177
CfgInt cfg_ClutchMortProb
CfgInt cfg_HQualityTall2
CfgFloat cfg_Cooling_Rate_Eggs
CfgInt cfg_HQualityHedgeScrub
CfgFloat cfg_MeanExtractionRatePerMinute
double NotTramline
Definition: skylarks_all.cpp:248
int HQualityTallVeg
Definition: skylarks_all.cpp:267
CfgFloat cfg_heightconstant_b
int HQualityTall2
Definition: skylarks_all.cpp:256
static int FoodTripsPerDay
Definition: skylarks_all.cpp:184
CfgInt cfg_Breed_Res_Thresh1
CfgFloat cfg_hindconstantD_b
CfgFloat cfg_densityconstant_b
CfgInt cfg_NestlingMortProb
static double MD_Threshold
Definition: skylarks_all.cpp:182
int HQualityMetalRoad
Definition: skylarks_all.cpp:258

References Breed_Res_Thresh1, cfg_Breed_Res_Thresh1, cfg_ClutchMortProb, cfg_Cooling_Rate_Eggs, cfg_densityconstant_a, cfg_densityconstant_b, cfg_densityconstant_c, cfg_EggTemp, cfg_FemaleMinTerritoryAcceptScore, cfg_FoodTripsPerDay, cfg_heightconstant_a, cfg_heightconstant_b, cfg_heightconstant_c, cfg_hindconstantD_b, cfg_hindconstantH_b, cfg_HQualityBareEarth, cfg_HQualityHedge, cfg_HQualityHedgeScrub, cfg_HQualityMetalRoad, cfg_HQualityNeutral, cfg_HQualityOpenTallVeg, cfg_HQualityTall, cfg_HQualityTall2, cfg_HQualityTallVeg, cfg_HQualityTrack, cfg_HQualityVeg30cm, cfg_HQualityWater, cfg_maxfeedrain, cfg_MD_Threshold, cfg_MeanExtractionRatePerMinute, cfg_MeanHatchingWeight, cfg_MinDaysToHatch, cfg_NestLeavingWeight, cfg_NestlingMortProb, cfg_NestPlacementMinQual, cfg_PatchyPremium, cfg_PreFledgeMortProb, cfg_rainhindpow, cfg_temphindpow, cfg_tramline_foraging, ClutchMortProb, Cooling_Rate_Eggs, DensityScore, EggTemp, FemaleNestAcceptScore, FoodTripsPerDay, HeightScore, HQualityBareEarth, HQualityHedge, HQualityHedgeScrub, HQualityMetalRoad, HQualityNeutral, HQualityOpenTallVeg, HQualityTall, HQualityTall2, HQualityTallVeg, HQualityTrack, HQualityVeg30cm, HQualityWater, IsTramline, m_NoChickDeaths, m_NoFledgeDeaths, m_NoPestEffects, MaxFeedRain, MD_Hatch, MD_Threshold, MeanExtractionRatePerMinute, MeanHatchingWeight, NestLeavingWeight, NestlingMortProb, NestPlacementMinQual, NotTramline, OpenTheBreedingSuccessProbe(), PatchyPremium, PreFledgeMortProb, RainHindrance, TempHindrance, CfgInt::value(), CfgFloat::value(), VegHindranceD, VegHindranceH, and VegTypeFledgelings.

Referenced by Init().

◆ OpenTheBreedingPairsProbe()

bool Skylark_Population_Manager::OpenTheBreedingPairsProbe ( )
virtual

Reimplemented from Population_Manager.

854  {
855  FILE * MyFile = fopen("BreedingPairs.txt", "w" );
856  if ( !MyFile ) {
857  g_msg->Warn( WARN_FILE, "Skylark_Population_Manager::FledgelingProbeOutput():",
858  "Cannot open file: BreedingPairs.txt" );
859  exit( 0 );
860  }
861  fclose(MyFile);
862  return true;
863 }

References g_msg, MapErrorMsg::Warn(), and WARN_FILE.

◆ OpenTheBreedingSuccessProbe()

bool Skylark_Population_Manager::OpenTheBreedingSuccessProbe ( )
virtual

Reimplemented from Population_Manager.

867  {
868  FILE * MyFile = fopen("BreedingSuccess.txt", "w" );
869  if ( !MyFile ) {
870  g_msg->Warn( WARN_FILE, "Skylark_Population_Manager::FledgelingProbeOutput():",
871  "Cannot open file: BreedingSuccess.txt" );
872  exit( 0 );
873  }
874  fclose(MyFile);
875  return true;
876 }

References g_msg, MapErrorMsg::Warn(), and WARN_FILE.

Referenced by LoadParameters().

◆ OpenTheFledgelingProbe()

bool Skylark_Population_Manager::OpenTheFledgelingProbe ( )
virtual

Reimplemented from Population_Manager.

900  {
901  FILE * MyFile = fopen("SkFledgelingProbe.txt", "w" );
902  if ( !MyFile ) return false;
903  FILE * MyFile2 = fopen("TOV_KeyForFledgelingProbe.txt", "w" );
904  if ( !MyFile2 ) return false;
905  fprintf( MyFile2, "This is the tov to veg-type key\n" );
906  int howMany = ( int )tov_Undefined;
907  for ( int i = 0; i <= howMany; i++ ) {
908  fprintf( MyFile2, "%d %s\n", i, (m_TheLandscape->VegtypeToString( (TTypesOfVegetation) i )).c_str());
909  }
910  fclose( MyFile );
911  fclose( MyFile2 );
912  return false;
913 }
std::string VegtypeToString(TTypesOfVegetation a_veg)
Definition: Landscape.cpp:4235
TTypesOfVegetation
Definition: tov_declaration.h:30

References Population_Manager::m_TheLandscape, tov_Undefined, and Landscape::VegtypeToString().

◆ ProbePOM()

float Skylark_Population_Manager::ProbePOM ( int  ListIndex,
probe_data p_TheProbe 
)
protected

Modified probe for POM Output.

1133  {
1134  // Counts through the list and goes through each area to see if the animal
1135  // is standing there and if the farm conditions are met
1136  float NumberSk = 0;
1137  if (ListIndex==4) {
1138  if ( p_TheProbe->m_NoFarms != 0 ) {
1139  for (unsigned j = 0; j < GetLiveArraySize(ListIndex); j++) {
1140  unsigned Farm = TheArray[ ListIndex ] [ j ]->SupplyFarmOwnerRef();
1141  for ( unsigned k = 0; k < p_TheProbe->m_NoFarms; k++ ) {
1142  if ( p_TheProbe->m_RefFarms[ k ] == Farm ) {
1143  Skylark_Female * FS;
1144  FS = dynamic_cast < Skylark_Female * > ( TheArray[ ListIndex ] [ j ] );
1145  TTypesOfSkState state = (TTypesOfSkState) FS->WhatState();
1146  switch (state) {
1147  case toss_MakingNest:
1149  case toss_Laying:
1150  case toss_StartingNewBrood:
1151  case toss_EggHatching:
1152  case toss_Incubating:
1153  case toss_FCaringForYoung:
1154  NumberSk++; // it is in the square so increment number
1155  default:
1156  ;
1157  }
1158  }
1159  }
1160  }
1161  }
1162  }
1163  else if (ListIndex==3)
1164  {
1165  if ( p_TheProbe->m_NoFarms != 0 )
1166  {
1167  for (unsigned j = 0; j < GetLiveArraySize(ListIndex); j++)
1168  {
1169  unsigned Farm = TheArray[ ListIndex ] [ j ]->SupplyFarmOwnerRef();
1170  for ( unsigned k = 0; k < p_TheProbe->m_NoFarms; k++ )
1171  {
1172  if ( p_TheProbe->m_RefFarms[ k ] == Farm )
1173  {
1174  Skylark_Male * MS;
1175  MS = dynamic_cast < Skylark_Male * > ( TheArray[ ListIndex ] [ j ] );
1176  if (MS->HaveTerritory) NumberSk++;// it is in the square so increment number
1177  }
1178  }
1179  }
1180  }
1181  }
1182  return NumberSk;
1183 }
The base class for all farm types.
Definition: farm.h:768
virtual int WhatState()
Definition: skylarks_all.h:618
bool HaveTerritory
Definition: skylarks_all.h:906
unsigned m_RefFarms[25]
Definition: PopulationManager.h:299
unsigned m_NoFarms
Definition: PopulationManager.h:296

References Population_Manager::GetLiveArraySize(), Skylark_Male::HaveTerritory, probe_data::m_NoFarms, probe_data::m_RefFarms, Population_Manager::TheArray, toss_EggHatching, toss_FCaringForYoung, toss_Incubating, toss_Laying, toss_MakingNest, toss_PreparingForBreeding, toss_StartingNewBrood, and Skylark_Base::WhatState().

Referenced by ProbeReportPOM().

◆ ProbeReportPOM()

void Skylark_Population_Manager::ProbeReportPOM ( int  a_time)
protected
1119  {
1120  for ( int ProbeNo = 0; ProbeNo < m_NoProbes; ProbeNo++ ) {
1121  int No = 0;
1122  unsigned Index = SupplyListIndexSize();
1123  for ( unsigned listindex = 0; listindex < Index; listindex++ ) {
1124  if ( TheProbe[ ProbeNo ]->m_TargetTypes[ listindex ] ) No += (int) ProbePOM( listindex, TheProbe[ ProbeNo ] );
1125  }
1126  TheProbe[ ProbeNo ]->FileOutput( No, a_time, ProbeNo );
1127  }
1128 }
unsigned SupplyListIndexSize()
Definition: PopulationManager.h:468
probe_data * TheProbe[100]
Definition: PopulationManager.h:510
int m_NoProbes
Definition: PopulationManager.h:525
float ProbePOM(int ListIndex, probe_data *p_TheProbe)
Modified probe for POM Output.
Definition: skylarks_all.cpp:1133
void FileOutput(int No, int time, int ProbeNo)
Definition: PopulationManager.cpp:1447

References probe_data::FileOutput(), Population_Manager::m_NoProbes, ProbePOM(), Population_Manager::SupplyListIndexSize(), and Population_Manager::TheProbe.

Referenced by DoFirst().

◆ ReHouse()

void Skylark_Population_Manager::ReHouse ( void  )
protectedvirtual
1186  {
1187  Skylark_Male* MS = NULL; // assignment to get rid of warning
1188  unsigned size = (unsigned)GetLiveArraySize(sob_Male);
1189  for ( unsigned j = 0; j < size; j++ ) {
1190  MS = dynamic_cast < Skylark_Male * > (TheArray[sob_Male][j]);
1191  if (MS->HaveTerritory) {
1192  MS->OnReHouse();
1193  }
1194  }
1195 }
void OnReHouse()
Definition: skylarks_all.cpp:4261

References Population_Manager::GetLiveArraySize(), Skylark_Male::HaveTerritory, Skylark_Male::OnReHouse(), sob_Male, and Population_Manager::TheArray.

◆ SetF_Mig_Mort()

void Skylark_Population_Manager::SetF_Mig_Mort ( int  m)
inline
508  {
509  F_Mig_Mort = m;
510  }

◆ SetM_Mig_Mort()

void Skylark_Population_Manager::SetM_Mig_Mort ( int  m)
inline
503  {
504  M_Mig_Mort = m;
505  }

◆ SupplyEMi()

double Skylark_Population_Manager::SupplyEMi ( )
inline

◆ SupplyF_Mig_Mort()

int Skylark_Population_Manager::SupplyF_Mig_Mort ( )
inline
492  {
493  return F_Mig_Mort;
494  }

Referenced by Skylark_Female::GetMigrationMortality().

◆ SupplyM_Mig_Mort()

int Skylark_Population_Manager::SupplyM_Mig_Mort ( )
inline
487  {
488  return M_Mig_Mort;
489  }

Referenced by Skylark_Male::GetMigrationMortality().

◆ SupplyNoTerritories()

int Skylark_Population_Manager::SupplyNoTerritories ( )
917  {
919 }
int SupplyNoTerritories()
Definition: skylarks_all.cpp:1422

References SkTerritories::SupplyNoTerritories(), and TheSkylarkTerrs.

◆ TheAOROutputProbe()

void Skylark_Population_Manager::TheAOROutputProbe ( )
virtual

This method must be overridden in descendent classes

Reimplemented from Population_Manager.

794  {
796 }
virtual void DoProbe(int a_lifestage)
Definition: AOR_Probe.cpp:59
AOR_Probe * m_AOR_Probe
Definition: PopulationManager.h:526

References AOR_Probe::DoProbe(), Population_Manager::m_AOR_Probe, and sob_Female.

◆ TheBreedingFemalesProbe()

int Skylark_Population_Manager::TheBreedingFemalesProbe ( int  ProbeNo)
virtual

Reimplemented from Population_Manager.

705  {
706  int NumberSk = 0;
707  Skylark_Male * MS;
708  for (unsigned j = 0; j < GetLiveArraySize(3); j++) {
709  MS = dynamic_cast < Skylark_Male * > ( TheArray[ 3 ] [ j ] );
710  /* for (unsigned i=0; i<TheProbe[ProbeNo]->m_NoAreas; i++) { if ((MS->m_Born_x>=(int)TheProbe[ProbeNo]->m_Rect[i].m_x1)
711  && (MS->m_Born_y>=(int)TheProbe[ProbeNo]->m_Rect[i].m_y1) && (MS->m_Born_x<(int)TheProbe[ProbeNo]->m_Rect[i].m_x2)
712  && (MS->m_Born_y<(int)TheProbe[ProbeNo]->m_Rect[i].m_y2) && (MS->Paired==true) && (MS->HaveTerritory==true))
713  NumberSk++; // it is in the square so increment number } */
714  if ( ( MS->Paired == true ) && ( MS->HaveTerritory == true ) )
715  NumberSk++; // it is in the square so increment number
716  }
717  return NumberSk;
718 }

References Population_Manager::GetLiveArraySize(), Skylark_Male::HaveTerritory, Skylark_Adult::Paired, and Population_Manager::TheArray.

◆ TheBreedingSuccessProbe()

int Skylark_Population_Manager::TheBreedingSuccessProbe ( int &  BreedingFemales,
int &  YoungOfTheYear,
int &  TotalPop,
int &  TotalFemales,
int &  TotalMales,
int &  BreedingAttempts 
)
virtual

Reimplemented from Population_Manager.

722  {
723  int NumberA = 0;
724  int HowMany = 0;
725  BreedingAttempts = 0;
726  Skylark_Female * FS;
727  unsigned sz = (int)GetLiveArraySize(4);
728  for ( unsigned j = 0; j < sz; j++ ) {
729  FS = dynamic_cast < Skylark_Female * > ( TheArray[ 4 ] [ j ] );
730  int success = FS->Supply_BreedingSuccess();
731 #ifdef __HazelParry1
732  if ( success >0 ) {
733  NumberA += success;
734  HowMany++;
735  FS->ResetBreedingSuccess();
736  }
737 #else
738  if ( success != -1 ) {
739  NumberA += success;
740  HowMany++;
741  }
742 #endif
743  BreedingAttempts += FS->Supply_BreedingAttempts();
744  }
745  BreedingFemales = HowMany;
746  TotalFemales = sz;
747  TotalMales = (int)GetLiveArraySize(3);
748  YoungOfTheYear = TheFledgelingProbe();
749  TotalPop = TotalFemales + TotalMales;
750  return NumberA;
751 }
void ResetBreedingSuccess()
Definition: skylarks_all.cpp:6114
int Supply_BreedingSuccess()
Definition: skylarks_all.cpp:6104
int Supply_BreedingAttempts()
Definition: skylarks_all.cpp:6094
int TheFledgelingProbe()
Definition: skylarks_all.cpp:683

References Population_Manager::GetLiveArraySize(), Skylark_Female::ResetBreedingSuccess(), Skylark_Female::Supply_BreedingAttempts(), Skylark_Female::Supply_BreedingSuccess(), Population_Manager::TheArray, and TheFledgelingProbe().

◆ TheFledgelingProbe()

int Skylark_Population_Manager::TheFledgelingProbe ( )
virtual

Reimplemented from Population_Manager.

683  {
684  int NumberSk = 0;
685  Skylark_Male * MS;
686  for (unsigned j = 0; j < GetLiveArraySize(3); j++) {
687  MS = dynamic_cast < Skylark_Male * > ( TheArray[ 3 ] [ j ] );
688  if ( MS->Age == 0 ) {
689  NumberSk++; // it is in the square so increment number
690  VegTypeFledgelings[ MS->m_MyHome ] ++;
691  }
692  }
693  Skylark_Female * FS;
694  for (unsigned j = 0; j < GetLiveArraySize(4); j++) {
695  FS = dynamic_cast < Skylark_Female * > ( TheArray[ 4 ] [ j ] );
696  if ( FS->Age == 0 ) {
697  NumberSk++; // it is in the square so increment number
698  VegTypeFledgelings[ FS->m_MyHome ] ++;
699  }
700  }
701  return NumberSk;
702 }
int m_MyHome
The vegetation type where the skylark was born.
Definition: skylarks_all.h:600
int Age
Definition: skylarks_all.h:595

References Skylark_Base::Age, Population_Manager::GetLiveArraySize(), Skylark_Base::m_MyHome, Population_Manager::TheArray, and VegTypeFledgelings.

Referenced by TheBreedingSuccessProbe().

◆ TheRipleysOutputProbe()

void Skylark_Population_Manager::TheRipleysOutputProbe ( FILE *  a_prb)
virtual

This method must be overridden in descendent classes

Reimplemented from Population_Manager.

799  {
800  Skylark_Female* FS;
801  unsigned totalF=0;
802  for (unsigned j = 0; j<GetLiveArraySize(sob_Female); j++) //adult females
803  {
804  FS=dynamic_cast<Skylark_Female*>(TheArray[4][j]);
805  if (FS->Paired) totalF++;
806  }
807  int x,y;
810  fprintf(a_prb,"%d %d %d %d %d\n", 0,w ,0, h, totalF);
811  for (unsigned j = 0; j<GetLiveArraySize(sob_Female); j++) //adult females
812  {
813  FS=dynamic_cast<Skylark_Female*>(TheArray[4][j]);
814  if (FS->Paired) {
815  x=FS->Supply_m_Location_x();
816  y=FS->Supply_m_Location_y();
817  fprintf(a_prb,"%d\t%d\n", x,y);
818  }
819  }
820  fflush(a_prb);
821 }

References Population_Manager::GetLiveArraySize(), Population_Manager::m_TheLandscape, Skylark_Adult::Paired, sob_Female, TAnimal::Supply_m_Location_x(), TAnimal::Supply_m_Location_y(), Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), and Population_Manager::TheArray.

◆ TheSkylarkTerrsSupply_quality()

int Skylark_Population_Manager::TheSkylarkTerrsSupply_quality ( int  r)
933  {
934  return TheSkylarkTerrs->Supply_quality( r );
935 }
int Supply_quality(int ref)
Definition: skylarks_all.cpp:2379

References SkTerritories::Supply_quality(), and TheSkylarkTerrs.

◆ TheSkylarkTerrsSupply_size()

int Skylark_Population_Manager::TheSkylarkTerrsSupply_size ( int  r)
929  {
930  return TheSkylarkTerrs->Supply_size( r );
931 }
int Supply_size(int ref)
Definition: skylarks_all.cpp:1471

References SkTerritories::Supply_size(), and TheSkylarkTerrs.

◆ TheSkylarkTerrsSupply_x()

int Skylark_Population_Manager::TheSkylarkTerrsSupply_x ( int  r)
921  {
922  return TheSkylarkTerrs->Supply_x( r );
923 }
int Supply_x(int ref)
Definition: skylarks_all.cpp:1415

References SkTerritories::Supply_x(), and TheSkylarkTerrs.

◆ TheSkylarkTerrsSupply_y()

int Skylark_Population_Manager::TheSkylarkTerrsSupply_y ( int  r)
925  {
926  return TheSkylarkTerrs->Supply_y( r );
927 }
int Supply_y(int ref)
Definition: skylarks_all.cpp:1465

References SkTerritories::Supply_y(), and TheSkylarkTerrs.

◆ WriteSKPOM1()

◆ WriteSKPOM2()

void Skylark_Population_Manager::WriteSKPOM2 ( int  n,
int  n2 
)
inline
482  {
483  fprintf( SKPOM2, "%i\t%i\n", n, n2 );
484  }

Referenced by Skylark_Nestling::OnDeserted(), Skylark_Nestling::OnYouHaveBeenEaten(), and Skylark_Nestling::st_Developing().

Member Data Documentation

◆ EMi

double Skylark_Population_Manager::EMi
protected

Referenced by DoFirst().

◆ F_Mig_Mort

int Skylark_Population_Manager::F_Mig_Mort
protected

◆ m_IsBadWeather

bool Skylark_Population_Manager::m_IsBadWeather
protected

Referenced by DoFirst().

◆ M_Mig_Mort

int Skylark_Population_Manager::M_Mig_Mort
protected

◆ m_NoChickDeaths

int Skylark_Population_Manager::m_NoChickDeaths
protected

Referenced by DoFirst(), Init(), and LoadParameters().

◆ m_NoFledgeDeaths

int Skylark_Population_Manager::m_NoFledgeDeaths
protected

Referenced by DoFirst(), Init(), and LoadParameters().

◆ m_NoPestEffects

int Skylark_Population_Manager::m_NoPestEffects
protected

Referenced by DoFirst(), Init(), and LoadParameters().

◆ m_StriglingMort

int Skylark_Population_Manager::m_StriglingMort[4]
protected

◆ m_TotalEggs

int Skylark_Population_Manager::m_TotalEggs
protected

Referenced by BreedingSuccessProbeOutput(), and Init().

◆ m_TotalNestlings

int Skylark_Population_Manager::m_TotalNestlings
protected

◆ m_TotalPrefledgelings

int Skylark_Population_Manager::m_TotalPrefledgelings
protected

◆ SKPOM1

FILE* Skylark_Population_Manager::SKPOM1
protected

◆ SKPOM2

FILE* Skylark_Population_Manager::SKPOM2
protected

◆ TheSkylarkTerrs

◆ VegTypeFledgelings

int Skylark_Population_Manager::VegTypeFledgelings[100]

The documentation for this class was generated from the following files: